<?
if (!defined('baseinfo')) {
    exitdata();
}   
?>
<script src="<?=baseinfo?>/js/vendor/jquery.iuploader-1.0.js"></script>
<script src="<?=baseinfo?>/js/vendor/jquery.Jcrop.min.js"></script>
<script src="<?=baseinfo?>/js/coreadd.js"></script>
<link rel="stylesheet" href="<?=baseinfo?>/css/vendor/jcrop/jquery.Jcrop.min.css" type="text/css" />
<link rel="stylesheet" href="<?=baseinfo?>/css/theme1/coreadd.css" type="text/css" />
<link rel="stylesheet" href="<?=baseinfo?>/js/vendor/minified/themes/default.min.css" type="text/css" media="all" />
    
    <div class="ovlPopGen wrpPopHtP"  style="display: none;" >
        <div class="popGen posPop">
            <div class="topGen clBd2 bdBtm">
                <div class="wrpTtlGen ">
                    <h1 class="ttlGen clTxt2 fs05 cutTxt">How to Pay</h1>
                </div>
                <div class="btnIco closeGen" onclick="$('.wrpPopHtP').fadeOut()">
                    <span class="ico icoCloseGen"></span>
                </div>
                <div class="topBgGen clBg3"></div>
            </div>
            <div class="bodyGen clBg3">
                <div class="bodyOutGen">
                    <div class="bodyInGen">
                        <div class="wrpFrmGen">
                            <div class="bodyHtP fs04 clTxt2">
                                <div class="shpNmOrdSum clBg1 clearfix showshopname">
                                    <a href="">
                                        <img src="img/dfthmbuser.jpg" class="genImgShp">
                                        <span class="cutTxt clTxt2 fs04" href="">Shop A</span>
                                    </a>
                                </div>
                                
                                
                                <div class="bdHtp">
                                    <div class="mtHtp clBg4">
                                        <div class="hdMtHtp clearfix">
                                            <span class="ttlMtHtp fs04 boldGen">Transfer</span>
                                            <button onclick="openpopuppayment()" class="btnMtHtp clTxtW clBgSp1 fs03">แจ้งชำระเงิน</button>
                                        </div>
                                        <div class="bdMtHtp fs03">
                                             <div class="hdTfHtp clBg2 clearfix">
                                                 <div class="tf tf1">
                                                     <span class="boldGen">Bank</span>
                                                 </div>
                                                 <div class="tf tf2">
                                                     <span class="boldGen">Branch</span>
                                                 </div>
                                                 <div class="tf tf3">
                                                     <span class="boldGen">Number</span>
                                                 </div>
                                                 <div class="tf tf4">
                                                     <span class="boldGen">Type</span>
                                                 </div>
                                                 <div class="tf tf5">
                                                     <span class="boldGen">Name</span>
                                                 </div>
                                             </div>
                                             <div class="bdTfHtp">

                                             </div>
                                        </div>
                                    </div>
                                    
                                    
                                    
                                    
                                </div>
                                
                            </div>
                        </div>
                    </div>
                </div>    
            </div>
        </div>
    </div>
    
    <div class="ovlPopGen wrpPopOrdCtmView" style="display: none;">
        <div class="popGen posPop">
            <div class="topGen clBd2 bdBtm">
                <div class="wrpTtlGen ">
                    <h1 class="ttlGen clTxt2 fs05 cutTxt ordertext">Order ID : ABC123456</h1>
                </div>
                <div class="btnIco closeGen" onclick="$('.wrpPopOrdCtmView').fadeOut()">
                    <span class="ico icoCloseGen"></span>
                </div>
                <div class="topBgGen clBg3"></div>
            </div>
            <div class="bodyGen clBg3">
                <div class="bodyOutGen">
                    <div class="bodyInGen">
                        <div class="wrpFrmGen">
                            <div class="bodyOrdView fs04 clTxt2">
                                <div class="ordCtmView clearfix clBg5">
                                    <div class="shpOrdCtmView clearfix displayshop">
                                        <a href=""><img src="img/dfthmbuser.jpg" class="genImgShp"><span class="cutTxt clTxt2 fs04" href="">Shop A</span></a>
                                    </div>
                                    <div class="sttsOrdCtmView">
                                        <div class="sttsView clearfix">
                                            <span class="boldGen">Status : </span>
                                            <div class="reDesign">
                                                <select class="fs01" name="statusorderset">
                                                    <option value="1">Reserve</option>
                                                    <option value="2">Paid</option>
                                                    <option value="3">Shipped</option>
                                                    <option value="4">Canceled</option>
                                                </select>
                                            </div>
                                            <button class="clTxtW clBgBt1 fs04 updatecartstatusbtn">Update</button>
                                        </div>
                                        <div class="wrpRefNo fs02">
                                            <a href="javascript:void(0)" class="btnAddRef">ใส่หมายเลขอ้างอิงการส่งสินค้า</a>
                                            <a href="javascript:void(0)" class="btnAddTellPaid">แจ้งการชำระเงิน</a>
                                        </div>

                                    </div>
                                </div>
                                <div class="wrpDateChnOrdView clearfix">
                                    <div class="dateOrdView">
                                        <span class="boldGen">Order On :</span>
                                        <span class="orderdate">18:00:00 10/10/2014</span>
                                    </div>
                                    <div class="chnOrdView">
                                        <span class="boldGen">Order Channel :</span>
                                        <span>Online</span>
                                    </div>
                                </div>
                                
                                <div class="wrpOrdSum">
                                    <div class="wrpHdTbCart clBg2">
                                        <div class="hdTbCart fs04 boldGen clearfix">
                                            <span class="ct os1">Product</span>
                                            <span class="ct os2">Price (Baht)</span>
                                            <span class="ct os3">Qty</span>
                                            <span class="ct os4">Amount (Baht)</span>
                                        </div>
                                    </div>
                                    <div class="wrpItmLstCart clBd2 bdBtm cartitemwrp">
                                        
                                                                                
                                        
                                    </div>
                                    <div class="wrpCouponCart clBd2 bdBtm">
                                        <div class="hdCpCart">
                                            <span class="fs03 boldGen">Coupon</span>
                                        </div>
                                        <div class="conponcart">
                                        <div class="itmLstCart fs03 clearfix clBd2">
                                            <div class="ct os10 clearfix">
                                                <span>Coupon Name</span>
                                            </div>
                                            <div class="ct os4 clearfix"><span>-100</span></div>
                                        </div>
                                        </div>
                                        
                                    </div>
                                    <div class="wrpRcCart clBd2 bdBtm">
                                        <div class="hdRcCart">
                                            <span class="fs03 boldGen">วิธีรับสินค้า</span>
                                        </div>
                                        <div class="itmLstCart fs03 clearfix clBd2 transportproduct">
                                            <div class="ct os10">
                                                <span>รับด้วยตนเอง</span>
                                            </div>
                                            <div class="ct os5"><span>0</span></div>
                                        </div>
                                    </div>
                                    <div class="wrpTotalCart">
                                        <div class="totalCart fs07 boldGen clearfix">
                                            <span class="ct os8">Total</span>
                                            <span class="ct os6 totalpricedata">200</span>
                                        </div>
                                    </div>
                                </div>
                                <div class="wrpShipOrd">
                                    <div class="hdShipInfo clBg2">
                                        <span class="boldGen">Shipping Information</span>
                                    </div>
                                    <div class="bdShipInfo fs03">
                                        <div class="showShipInfo clearfix">
                                            <span class="si1 boldGen">Name</span>
                                            <span class="si2 displaynameshow">Nopp</span>
                                        </div>
                                        <div class="showShipInfo clearfix">
                                            <span class="si1 boldGen">Email</span>
                                            <span class="si2 emailshow">Nopp@mail.com</span>
                                        </div>
                                        <div class="showShipInfo clearfix">
                                            <span class="si1 boldGen">Tel</span>
                                            <span class="si2 phoneshow">088-888-8888</span>
                                        </div>
                                        <div class="showShipInfo clearfix">
                                            <span class="si1 boldGen">Address</span>
                                            <span class="si2 addressshow">3 Prachasongkroh 33 Din Daeng Bangkok 10400</span>
                                        </div>
                                    </div>
                                </div>
                                <div class="wrpMoreOrd">
                                    <div class="hdShipInfo clBg2">
                                        <span class="boldGen">More Information</span>
                                    </div>
                                    <div class="bdShipInfo fs03">
                                        <span class="noteshow">Bla Bla Bla</span>
                                    </div>
                                </div>
                                <div class="wrpShipOrd">
                                    <div class="hdShipInfo clBg2">
                                        <span class="boldGen">Payment Information</span>
                                    </div>
                                 <!--   <div class="bdShipInfo fs03">
                                        <div class="noPay">
                                            
                                            <button class="btnCtmOrdViewHtP clBgSp1 clTxtW fs03 howtopaybtn">How to Pay</button>
                                        </div>
                                    </div>-->
                                    
                                    
                                    
                                    <div class="userpayshow" >
                                    <div class="bdShipInfo fs03">
                                        <div class="showShipInfo clearfix">
                                            <span class="si1 boldGen">Inform Date</span>
                                            <span class="si2">11:00:00 10/10/2014</span>
                                        </div>
                                        <div class="showShipInfo clearfix">
                                            <span class="si1 boldGen">Channel</span>
                                            <span class="si2">Bla Bla Bla</span>
                                        </div>
                                        <div class="showShipInfo clearfix">
                                            <span class="si1 boldGen">Payment Date</span>
                                            <span class="si2">10/10/2013</span>
                                        </div>
                                        <div class="showShipInfo clearfix">
                                            <span class="si1 boldGen">Payment Time</span>
                                            <span class="si2">10:10</span>
                                        </div>
                                        <div class="showShipInfo clearfix">
                                            <span class="si1 boldGen">Amount</span>
                                            <span class="si2">200 Baht</span>
                                        </div>
                                        <div class="showShipInfo clearfix">
                                            <span class="si1 boldGen">More Details</span>
                                            <span class="si2">-</span>
                                        </div>
                                        <div class="showShipInfo clearfix">
                                            <span class="si1 boldGen">Attrach File</span>
                                            <span class="si2">-</span>
                                        </div>
                                    </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>    
            </div>
        </div>
    </div>
    
    
    <div class="ovlPopGen wrpPopTellPaid" id="feature1" style="display: none;">
        <div class="popGen posPop">
            <div class="topGen clBd2 bdBtm">
                <div class="wrpTtlGen ">
                    <h1 class="ttlGen clTxt2 fs05 cutTxt">แจ้งการชำระเงิน</h1>
                </div>
                <div class="btnIco closeGen" onclick="$('.wrpPopTellPaid').fadeOut()">
                    <span class="ico icoCloseGen"></span>
                </div>
                <div class="topBgGen clBg3"></div>
            </div>
            <div class="bodyGen clBg3">
                <div class="bodyOutGen">
                    <div class="bodyInGen">
                        <div class="wrpFrmGen">
                            <div class="bodyTellPaid fs04 clTxt2">
                                <div class="bdTellPaid">
                                    <div class="inpTellPaid clearfix">
                                        <span class="boldGen fs03">Order ID</span>
                                        <div class="tellPaidLst">
                                            <span class="btnTellPaidOrdView">ABC123456</span>
                                        </div>
                                    </div>
                                    <div class="inpTellPaid clearfix">
                                        <span class="boldGen fs03">Payment Channel*</span>
                                        <div class="tellPaidLst">
                                            <div class="bankLst">
                                                <input type="radio" checked="" name="paymet">
                                                <label>Transfer</label>
                                            </div>
                                            
                                        </div>
                                    </div>
                                    <div class="inpTellPaid clearfix">
                                        <span class="boldGen fs03">Deposit Account*</span>
                                        <div class="tellPaidLst banklistdata">
                                        <!--    <div class="bankLst">
                                                <input type="radio" checked="" name="bnkLst">
                                                <label>ธนาคารกรุงเทพ สาขาดินแดง 000-0-00000-0</label>
                                            </div>
                                            <div class="bankLst">
                                                <input type="radio" name="bnkLst">
                                                <label>ธนาคารกรุงเทพ สาขาดินแดง 000-0-00000-0</label>
                                            </div>-->
                                        </div>
                                    </div>
                                    <div class="inpTellPaid clearfix">
                                        <span class="boldGen fs03">Date*</span>
                                        <div class="tellPaidLst">
                                            <input type="text" name="datepay" class="fs03 clBg5 clBd2 bdFull">
                                        </div>
                                    </div>
                                    <div class="inpTellPaid clearfix">
                                        <span class="boldGen fs03">Time*</span>
                                        <div class="tellPaidLst">
                                            <div class="reDesign">
                                                <select name="timepay" class="fs01">
                                                    <option value="">hour</option>
                                                    <option value="00">00</option>
                                                    <option value="01">01</option>
                                                    <option value="02">02</option>
                                                    <option value="03">03</option>
                                                    <option value="04">04</option>
                                                    <option value="05">05</option>
                                                    <option value="06">06</option>
                                                    <option value="07">07</option>
                                                    <option value="08">08</option>
                                                    <option value="09">09</option>
                                                    <option value="10">10</option>
                                                    <option value="11">12</option>
                                                    <option value="13">13</option>
                                                    <option value="14">14</option>
                                                    <option value="15">15</option>
                                                    <option value="16">16</option>
                                                    <option value="17">17</option>
                                                    <option value="18">18</option>
                                                    <option value="19">19</option>
                                                    <option value="20">20</option>
                                                    <option value="21">21</option>
                                                    <option value="22">22</option>
                                                    <option value="23">23</option>
                                                </select>
                                            </div>
                                            <div class="reDesign">
                                                <select name="minpay" class="fs01">
                                                    <option value="">min</option>
                                                    <option value="00">00</option>
                                                    <option value="10">10</option>
                                                    <option value="20">20</option>
                                                    <option value="30">30</option>
                                                    <option value="40">40</option>
                                                    <option value="50">50</option>
                                                </select>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="inpTellPaid clearfix">
                                        <span class="boldGen fs03">Amount (Baht)*</span>
                                        <div class="tellPaidLst">
                                            <input type="text" name="amountbaht" class="fs03 clBg5 clBd2 bdFull">
                                        </div>
                                    </div>
                                    <div class="inpTellPaid clearfix">
                                        <span class="boldGen fs03">More Details</span>
                                        <div class="tellPaidLst">
                                            <textarea name="moredetail" class="mreDt fs03 clBg5 clBd2 bdFull"></textarea>
                                        </div>
                                    </div>
                                    <div class="inpTellPaid clearfix image1">
                                        <span class="boldGen fs03">Proof of Payment</span>
                                        <div class="tellPaidLst wrpSlipAtm">
                                            <div class="slipAtm clBd2 clBg4 bdFull plgArea"></div>
                                            <div class="addTnTl clBd2 bdBtm">
                                                <div title="Browse" class="btnIco addImgTl clBd3 bdBtm uploadbutton">
                                                    <span class="ico icoAddImgTl"></span>
                                                    <div class="wrpUlFile">
                                                       <!-- <input type="file" class="ulFile">-->
                                                    </div>
                                                </div>
                                                <div title="Cloud" class="btnIco addCldTl clBd3 bdBtm cloudbutton">
                                                    <span class="ico icoAddCldTl"></span>
                                                </div>
                                                <div title="Link" class="btnIco addLnkTl clBd3 bdBtm linkbutton">
                                                    <span class="ico icoAddLnkTl"></span>
                                                </div>
                                                <div title="Remove" class="btnIco btnRmvTl deletebutton">
                                                    <span class="ico icoRmvTl"></span>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="btnShipInfo">
                                    <button onclick="sendpaymentuser()" class="clTxtW clBgSp1 fs04">Send</button>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>    
            </div>
        </div>
    </div>
    
    <div class="ovlPopGen wrpPopAddRefNo" style="display: none;">
        <div class="popGen posPop">
            <div class="topGen clBd2 bdBtm">
                <div class="wrpTtlGen ">
                    <h1 class="ttlGen clTxt2 fs05 cutTxt">หมายเลขอ้างอิงการส่งสินค้า</h1>
                </div>
                <div class="btnIco closeGen" onclick="$('.wrpPopAddRefNo').fadeOut()">
                    <span class="ico icoCloseGen"></span>
                </div>
                <div class="topBgGen clBg3"></div>
            </div>
            <div class="bodyGen clBg3">
                <div class="bodyOutGen">
                    <div class="bodyInGen">
                        <div class="wrpFrmGen">
                            <div class="bodyRefNo fs04 clTxt2">
                                <div class="bdRefNo">
                                    <div class="inpShipInfo clearfix">
                                        <span class="boldGen fs03">Order ID</span>
                                        <span class="ordRef">ABC123456</span>
                                    </div>
                                    <div class="inpShipInfo clearfix">
                                        <span class="boldGen fs03">รหัสพัสดุ</span>
                                        <input name="code" type="text" class="fs03 clBg5 clBd2 bdFull">
                                    </div>
                                    <div class="inpShipInfo clearfix">
                                        <span class="boldGen fs03">Note</span>
                                        <textarea name="note" class="fs03 clBg5 clBd2 bdFull"></textarea>
                                    </div>
                                </div>
                                <div class="btnShipInfo">
                                    <button onclick="saverefshipping()" class="clTxtW clBgSp1 fs04 ">Send</button>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>    
            </div>
        </div>
    </div>

<script>
var shopid=0;
var productid=0;
var quantityset=0;
var orderid=0;
var suborderid=0;
var useridset=0;
var rownow=1;
var rowdatanum=1;

 var bankdata=<?if(count($data['bank'])){echo json_encode($data['bank']);}else{ echo "new Array()";}?>;
 var banktypedata=<?if(count($data['banktype'])){echo json_encode($data['banktype']);}else{ echo "new Array()";}?>;
 
function imageset(rowgnowset,widthset,heightset,widthset2,heightset2)
{
var rownow=1;
var rowgnow=rowgnowset;
 
 $('#feature'+rownow+' .image'+rowgnow+' .uploadbutton').iuploader({
         'link':serviceinfo+'iupload',
         'accept':'image/*',
         'group':rowgnow,

         'type':['jpg', 'jpeg', 'png', 'gif'],
         'onUploadFinish':function(filename,filelink,setting){
         
         
         
         
         getpopupboxresize(widthset,heightset,filelink,setting['originalwidth'],setting['originalheight'],
         
         function(filename2,filelink2,width2,height2,imgmid2){
         var rowgnow2=setting['group'];        
         $('#feature'+rownow+' .image'+rowgnow2+' .plgArea').html('<a target="_blank" href="'+filelink+'?t='+Math.floor((Math.random()*100000)+1)+'"><img height="'+heightset2+'" width="'+widthset2+'" src="'+filelink2+'?t='+Math.floor((Math.random()*100000)+1)+'"></a>');
         $('#feature'+rownow+' .image'+rowgnow2+' input[name="filelink[]"]').val(filelink);
         $('#feature'+rownow+' .image'+rowgnow2+' input[name="filelinkcrop[]"]').val(filelink2);                 
         $('#feature'+rownow+' .image'+rowgnow2+' input[name="fileold[]"]').val(setting.fileold);      
         $("#width-"+setting.id).val(setting.originalwidth);
         $("#height-"+setting.id).val(setting.originalheight);      
         $("#imgmid-"+setting.id).val(setting.imgmid);       
         $("#simgmid-"+setting.id).val(imgmid2);               
         $("#widthcrop-"+setting.id).val(width2);
         $("#heightcrop-"+setting.id).val(height2);    
         
          closepopup();  
         }
         ,setting['imgmid']
         
         );
         //alert(filename);
         }
   });
  
  
   $('#feature'+rownow+' .image'+rowgnow+' .cloudbutton').click(function() {
          //console.log("testdata");
          //var rowgnow3=rowgnow;
          var rowgnow3=rowgnowset;
        //alert("Handler for .click() called.");
          getpopupcloud(
          function(filename2,filelink2,width2,height2,imgmid2,index2){ 

        $('#feature'+rownow+' .image'+rowgnow3+' .plgArea').html('<a target="_blank" href="'+$('#feature'+rownow+' .image'+rowgnow3+' input[name="filelink[]"]').val()+'?t='+Math.floor((Math.random()*100000)+1)+'"><img height="'+heightset2+'" width="'+widthset2+'" src="'+filelink2+'?t='+Math.floor((Math.random()*100000)+1)+'"></a>');
         $('#feature'+rownow+' .image'+rowgnow3+' input[name="simgmid[]"]').val(imgmid2);
         $('#feature'+rownow+' .image'+rowgnow3+' input[name="filelinkcrop[]"]').val(filelink2);                                    
         $('#feature'+rownow+' .image'+rowgnow3+' input[name="widthcrop[]"]').val(width2);         
         $('#feature'+rownow+' .image'+rowgnow3+' input[name="heightcrop[]"]').val(height2);

        closepopup();  

          
          },
          
          
          function(filename,filelink,width,height,imgmid,indexnow){
            
            $('#feature'+rownow+' .image'+rowgnow3+' input[name="filelink[]"]').val(filelink);
            $('#feature'+rownow+' .image'+rowgnow3+' input[name="imgmid[]"]').val(imgmid);           
            $('#feature'+rownow+' .image'+rowgnow3+' input[name="width[]"]').val(width);
            $('#feature'+rownow+' .image'+rowgnow3+' input[name="height[]"]').val(height);
            

          
          }
          ,
          rowgnow
          ,widthset
          ,heightset
          
          );

   });
   
   $('#feature'+rownow+' .image'+rowgnow+'  .deletebutton').click(function() {
   
   var rowgnow3=rowgnowset;
   

   $('#feature'+rownow+' .image'+rowgnow3+' .plgArea a').remove();
   
   $('#feature'+rownow+' .image'+rowgnow3+' input[name="filelink[]"]').val('');
   $('#feature'+rownow+' .image'+rowgnow3+' input[name="imgmid[]"]').val('');           
   $('#feature'+rownow+' .image'+rowgnow3+' input[name="width[]"]').val('');
   $('#feature'+rownow+' .image'+rowgnow3+' input[name="height[]"]').val('');
   
   
   
    $('#feature'+rownow+' .image'+rowgnow3+' input[name="simgmid[]"]').val('');
     $('#feature'+rownow+' .image'+rowgnow3+' input[name="filelinkcrop[]"]').val('');                                    
     $('#feature'+rownow+' .image'+rowgnow3+' input[name="widthcrop[]"]').val('');         
     $('#feature'+rownow+' .image'+rowgnow3+' input[name="heightcrop[]"]').val('');
   
   });
   
   $('#feature'+rownow+' .image'+rowgnow+' .linkbutton').click(function() {
   var rowgnow3=rowgnowset;
   //console.log("test");
   
   getpopuplink(
          function(filename2,filelink2,width2,height2,imgmid2,index2){ 
          
          
         $('#feature'+rownow+' .image'+rowgnow3+' .plgArea').html('<a target="_blank" href="'+$('#feature'+rownow+' .image'+rowgnow3+' input[name="filelink[]"]').val()+'?t='+Math.floor((Math.random()*100000)+1)+'"><img height="'+heightset2+'" width="'+widthset2+'" src="'+filelink2+'?t='+Math.floor((Math.random()*100000)+1)+'"></a>');
         
         $('#feature'+rownow+' .image'+rowgnow3+' input[name="simgmid[]"]').val(imgmid2);
         $('#feature'+rownow+' .image'+rowgnow3+' input[name="filelinkcrop[]"]').val(filelink2);                                    
         $('#feature'+rownow+' .image'+rowgnow3+' input[name="widthcrop[]"]').val(width2);         
         $('#feature'+rownow+' .image'+rowgnow3+' input[name="heightcrop[]"]').val(height2);
        // $.colorbox.close("User added succesfully"); 
        closepopup();  
          
          },
          function(filename,filelink,width,height,imgmid,indexnow){
            

            $('#feature'+rownow+' .image'+rowgnow3+' input[name="filelink[]"]').val(filelink);
            $('#feature'+rownow+' .image'+rowgnow3+' input[name="imgmid[]"]').val(imgmid);           
            $('#feature'+rownow+' .image'+rowgnow3+' input[name="width[]"]').val(width);
            $('#feature'+rownow+' .image'+rowgnow3+' input[name="height[]"]').val(height);
            

          
          }
          ,
          rowgnow
          ,widthset
          ,heightset
   );
   
   });
   
    $('#feature'+rownow+' .image'+rowgnow+' .deleterowbutton').click(function(){
   
    $('#feature'+rownow).remove();

});

}
function changetabcartmanage(tabset)
{
if(tabset=='wrprOrdHtr')
{

getshopmyorderlist();

}
$('.carttab').hide();
$('.'+tabset).show();
$('.tgHdGen.tgCl.clBd2').removeClass('clSp2');
$('#set-'+tabset).addClass('clSp2');


}

function removethisrow(rowdatanumset)
{

$('#rowdivdata-'+rowdatanumset).remove();

var numrow=1;
$('.rowpayment .spanrow').each(function( index ) {
 $(this).html(numrow+'.');
 numrow++;


});


numrow=1;
$('.rowtransport .spanrow').each(function( index ) {
 $(this).html(numrow+'.');
 numrow++;
});

numrow=1;
$('.rowpaymentetc .spanrow').each(function( index ) {
 $(this).html(numrow+'.');
 numrow++;


});

}
function addtransport(tspname,tspcost)
{
var tspnameset='';
if(tspname)
{
tspnameset=tspname;
}

var tspcostset='';
if(tspcost)
{
tspcostset=tspcost;
}

var code = '<div class="wrpLstHtPCrtMn clBg4 clBd2 bdFull clearfix rowtransport" id="rowdivdata-'+rowdatanum+'">\n';
code += '<div class="ordHtPCrtMn">\n';
code += '<span class="spanrow">1.</span>\n';
code += '</div>\n';
code += '<div class="wrpOutLstHtPCrtMn">\n';
code += '<div class="wrpInLstHtPCrtMn clearfix">\n';
code += '<div class="lstTspCrtMn">\n';
code += '<span>Transport Name</span>\n';
code += '<input type="text" name="tspname[]" value="'+tspnameset+'" class="inpAddCtnt w120 clBg5 clBd2 fs03 clTxt2">\n';
code += '</div>\n';
code += '<div class="lstTspCrtMn">\n';
code += '<span>Cost (Baht)</span>\n';
code += '<input type="text" name="tspcost[]" value="'+tspcostset+'" class="inpAddCtnt w120 clBg5 clBd2 fs03 clTxt2">\n';
code += '</div>\n';
code += '</div>\n';
code += '</div>\n';
code += '<div class="btnBnkCrtMn">\n';
code += '<button class="clBgBt1 clTxtW fs04" onclick="removethisrow('+rowdatanum+')">Remove</button>\n';
code += '</div>\n';
code += '</div>';

$('#addtransporterdiv').append(code);


var numrow=1;
$('.rowtransport .spanrow').each(function( index ) {
 $(this).html(numrow+'.');
 numrow++;


});


}
function addpaymentsetting(bankid,accnumber,accname,branch,actypeid)
{
var bankidset=0;
if(bankid)
{
bankidset=bankid;
}

var accnumberset='';
if(accnumber)
{
accnumberset=accnumber;
}

var accnameset='';
if(accname)
{
accnameset=accname;
}


var branchset='';
if(branch)
{
branchset=branch;
}


var actypeidset='';
if(actypeid)
{
actypeidset=actypeid;
}



var code = '<div class="wrpLstHtPCrtMn clBg4 clBd2 bdFull clearfix rowpayment" id="rowdivdata-'+rowdatanum+'" >\n';
code += '<div class="ordHtPCrtMn">\n';
code += '<span class="spanrow" >1.</span>\n';
code += '</div>\n';
code += '<div class="wrpOutLstHtPCrtMn">\n';
code += '<div class="wrpInLstHtPCrtMn clearfix">\n';
code += '<div class="lstHtPCrtMn">\n';
code += '<span>Bank</span>\n';
code += '<div class="reDesign reDsBnk">\n';
code += '<select name="bankid[]">\n';

if(bankdata.length)
{
var selected='';
$.each(bankdata, function(key, value) {

selected='';
if(bankidset==value.bankid)
{
selected='selected="selected"';
}
code +='<option '+selected+' value="'+value.bankid+'">'+value.bankname+'</option>';

});
}

code += '</select>\n';
code += '</div>\n';
code += '</div>\n';
code += '<div class="lstHtPCrtMn">\n';
code += '<span>Account Number</span>\n';
code += '<input name="accnumber[]" value="'+accnumberset+'" type="text" class="inpAddCtnt w120 clBg5 clBd2 fs03 clTxt2">\n';
code += '</div>\n';
code += '<div class="lstHtPCrtMn">\n';
code += '<span>Account Name</span>\n';
code += '<input type="text" value="'+accnameset+'" name="accname[]" class="inpAddCtnt w120 clBg5 clBd2 fs03 clTxt2">\n';
code += '</div>\n';
code += '<div class="lstHtPCrtMn">\n';
code += '<span>Branch</span>\n';
code += '<input type="text" value="'+branchset+'" name="branch[]" class="inpAddCtnt w120 clBg5 clBd2 fs03 clTxt2">\n';
code += '</div>\n';
code += '<div class="lstHtPCrtMn">\n';
code += '<span>Account Type</span>\n';
code += '<div class="reDesign reDsTypeBnk">\n';
code += '<select name="actypeid[]">\n';



if(banktypedata.length)
{
var selected='';
$.each(banktypedata, function(key, value) {

selected='';
if(actypeidset==value.actypeid)
{
selected='selected="selected"';
}
code +='<option '+selected+' value="'+value.actypeid+'">'+value.typename+'</option>';

});
}


code += '</select>\n';
code += '</div>\n';
code += '</div>\n';
code += '</div>\n';
code += '</div>\n';
code += '<div class="btnBnkCrtMn">\n';
code += '<button class="clBgBt1 clTxtW fs04" onclick="removethisrow('+rowdatanum+')">Remove</button>\n';
code += '</div>\n';
code += '</div>';

$('#addpaymentdiv').append(code);

var numrow=1;
$('.rowpayment .spanrow').each(function( index ) {
 $(this).html(numrow+'.');
 numrow++;


});
rowdatanum++;

}
function addpaymentetc(payname,paydescription)
{
var paydescriptionset='';
if(paydescription)
{
paydescriptionset=paydescription;
}

var paynameset='';
if(payname)
{
paynameset=payname;
}

var code = '<div class="wrpLstHtPCrtMn clBg4 clBd2 bdFull clearfix rowpaymentetc" id="rowdivdata-'+rowdatanum+'">\n';
code += '<div class="ordHtPCrtMn">\n';
code += '<span class="spanrow">1.</span>\n';
code += '</div>\n';
code += '<div class="wrpOutLstHtPCrtMn">\n';
code += '<div class="wrpInLstHtPCrtMn clearfix">\n';
code += '<div class="lstEtcCrtMn">\n';
code += '<span>Payment Name</span>\n';
code += '<input type="text" value="'+paynameset+'" name="payname[]" class="inpAddCtnt w120 clBg5 clBd2 fs03 clTxt2">\n';
code += '</div>\n';
code += '<div class="lstEtcCrtMn">\n';
code += '<span>Description</span>\n';
code += '<textarea name="paydescription[]" class="inpAddCtnt w120 clBg5 clBd2 fs03 clTxt2">'+paydescriptionset+'</textarea>\n';
code += '</div>\n';
code += '</div>\n';
code += '</div>\n';
code += '<div class="btnBnkCrtMn">\n';
code += '<button class="clBgBt1 clTxtW fs04" onclick="removethisrow('+rowdatanum+')">Remove</button>\n';
code += '</div>\n';
code += '</div>';



$('#addpaymentetcdiv').append(code);

var numrow=1;
$('.rowpaymentetc .spanrow').each(function( index ) {
 $(this).html(numrow+'.');
 numrow++;


});
rowdatanum++;



}
function openpopuptranfer(userid,orderid)
{

   $.get(serviceinfo+'gettranferdata', {userid:userid}, function(data) {  
    
    var code='';
    $('.wrpPopHtP .bdTfHtp').html('');
    paymentobj={};
    paymentobj=data;
    paymentobj['orderid']=orderid;
    paymentobj['userid']=userid;
if(data.data.data.length)
{
var code='';
$.each(data.data.data, function(key, value) {

code += '<div class="lstTf clBd2 bdBtm clearfix">\n';
code += '<div class="tf tf1 clearfix">\n';
code += '<span>'+value['bankname']+'</span>\n';
code += '</div>\n';
code += '<div class="tf tf2 clearfix">\n';
code += '<span>'+value['branch']+'</span>\n';
code += '</div>\n';
code += '<div class="tf tf3 clearfix">\n';
code += '<span>'+value['accnumber']+'</span>\n';
code += '</div>\n';
code += '<div class="tf tf4 clearfix">\n';
code += '<span>'+value['typename']+'</span>\n';
code += '</div>\n';
code += '<div class="tf tf5 clearfix">\n';
code += '<span>'+value['accname']+'</span>\n';
code += '</div>\n';
code += '</div>';

});

$('.wrpPopHtP .bdTfHtp').html(code);



}


//var showshopname= $('#shopcart-'+useridset+' .showshopname').html();

var showshopname='<a href="'+baseinfo+'/'+data.data.user.username+'"><img src="'+data.data.user.img.newpath+'" class="genImgShp"><span class="cutTxt clTxt2 fs04" >'+data.data.user.displayname+'</span></a>';
//console.log('#shopcart-'+useridset+' .showshopname');
//console.log(showshopname);
$('.wrpPopHtP .showshopname').html(showshopname);
$('.wrpPopOrdSum').fadeOut();

$('.wrpPopHtP').fadeIn();
    
    
    });
    


}
function sendpaymentuser()
{
var arrayobj={};

arrayobj['orderid']=paymentobj.orderid;
arrayobj['shopid']=paymentobj.userid;
if($('.wrpPopTellPaid input[name="radiopayment"]:checked').length==0)
{
alertwrongboxmsgonly('Please Select Payment');
return false;
}
arrayobj['tfid']=$('.wrpPopTellPaid input[name="radiopayment"]:checked').val();

if($('.wrpPopTellPaid input[name="datepay"]').val()=='')
{
alertwrongboxmsgonly('Please Input Date');
return false;
}
arrayobj['datepay']=$('.wrpPopTellPaid input[name="datepay"]').val();


if($('.wrpPopTellPaid select[name="timepay"]').val()=='')
{
alertwrongboxmsgonly('Please Input Time');
return false;
}
arrayobj['timepay']=$('.wrpPopTellPaid select[name="timepay"]').val();

if($('.wrpPopTellPaid select[name="minpay"]').val()=='')
{
alertwrongboxmsgonly('Please Input Time');
return false;
}
arrayobj['minpay']=$('.wrpPopTellPaid select[name="minpay"]').val();

if($('.wrpPopTellPaid input[name="amountbaht"]').val()=='')
{
alertwrongboxmsgonly('Please Input Amount');
return false;
}
arrayobj['amount']=$('.wrpPopTellPaid input[name="amountbaht"]').val();
arrayobj['detail']=$('.wrpPopTellPaid textarea[name="moredetail"]').val();
arrayobj['imgmid']=$('.wrpPopTellPaid input[name="imgmid[]"]').val();
arrayobj['simgmid']=$('.wrpPopTellPaid input[name="simgmid[]"]').val();
//console.log(arrayobj);
loaddata();
$.post(serviceinfo+'savehistorypayment', arrayobj, function(data) {  
loadclosedata(); 
boxmsgdata('Done');
$('.wrpPopTellPaid').fadeOut();
});






}

var paymentobj={};
function openpopuppayment()
{


$('.wrpPopTellPaid .btnTellPaidOrdView').html(paymentobj.data.user.orderprefix+''+paymentobj.orderid);
var code='';

if(paymentobj.data.data.length)
{
$.each(paymentobj.data.data, function(key, value) {
code += '<div class="bankLst">\n';
code += '<input type="radio" value="'+value['tfid']+'"  name="radiopayment" >\n';
code += '<label>'+value['bankname']+' '+value['branch']+' '+value['accnumber']+'</label>\n';
code += '</div>';
});

}

$('.wrpPopTellPaid .banklistdata').html(code);
$('.wrpPopTellPaid input[name="datepay"]').val('');
$('.wrpPopTellPaid select[name="timepay"]').val('');
$('.wrpPopTellPaid select[name="minpay"]').val('');
$('.wrpPopTellPaid input[name="amountbaht"]').val('');
$('.wrpPopTellPaid textarea[name="moredetail"]').val('');
$('.wrpPopTellPaid input[name="imgmid[]"]').val('');
$('.wrpPopTellPaid input[name="simgmid[]"]').val('');

$('.wrpPopTellPaid .plgArea').html('');



$('.wrpPopTellPaid').fadeIn();


}



function openpopupshipping(orderidset)
{

orderid=orderidset;
$('.wrpPopAddRefNo .ordRef').html($('.wrpPopOrdCtmView .ordertext').html());

if(orderbyobj.shipping.pshipid)
{





$('.wrpPopAddRefNo input[name="code"]').val(orderbyobj.shipping.code);
$('.wrpPopAddRefNo textarea[name="note"]').val(orderbyobj.shipping.note);

}
//$('.wrpPopAddRefNo .ordRef').html($('.wrpPopOrdCtmView .ordertext').html());

$('.wrpPopAddRefNo').fadeIn();






}

function saverefshipping()
{
var arraydata={};
arraydata['code']=$('.wrpPopAddRefNo input[name="code"]').val();
arraydata['note']=$('.wrpPopAddRefNo textarea[name="note"]').val();
arraydata['orderid']=orderid;


loaddata();
$.post(serviceinfo+'saverefnocart',arraydata, function(data) {
   loadclosedata();   
    if(data.error.response)
    {
    alertbox(data.error.error);

    }else
    {
    boxmsgdata('Done');
    $('.wrpPopAddRefNo').fadeOut();
    }  
});


}
var orderbyobj={};
function getorderlistbyorderid(orderid)
{
loaddata();
$.get(serviceinfo+'getordershopbyorderid', {orderid:orderid}, function(data) {  
loadclosedata();
 if(data.error.response)
        {
        
        if(data.error.error[0].code==5)
        {
        $('.ovlPopLd').hide();
        $('.wrpPopLI').fadeIn();

        //console.log('test');
        }
        
        }else
        {
        
        orderbyobj=data.data;
        $('.wrpPopAddRefNo input[name="code"]').val('');
$('.wrpPopAddRefNo textarea[name="note"]').val('');
$('.wrpPopOrdCtmView .ordertext').html('Order ID : '+data.data.orderprefix+''+data.data.orderid);
$('.wrpPopOrdCtmView .displayshop').html('<a target="_blank" href="'+baseinfo+'/'+data.data.username+'"><img src="'+data.data.simg.newpath+'" class="genImgShp"><span class="cutTxt clTxt2 fs04" >'+data.data.displayname+'</span></a>');

var statusset='';
var code ='';
if(data.data.status=='1')
 {

code += '<option value="1">Reserve</option>\n';
code += '<option value="2">Paid</option>\n';
code += '<option value="3">Shipped</option>\n';
code += '<option value="4">Canceled</option>';
 }
 else if(data.data.status=='2')
 {
    
    code += '<option value="2">Paid</option>\n';
code += '<option value="3">Shipped</option>\n';
code += '<option value="4">Canceled</option>';
 
 }
 else if(data.data.status=='3')
 {
    code += '<option value="3">Shipped</option>\n';
code += '<option value="4">Canceled</option>';
 
 }
 else if(data.data.status=='4')
 {
    statusset='Canceled';
    code += '<option value="4">Canceled</option>';
    
 
 }

 $('.wrpPopOrdCtmView select[name="statusorderset"]').html(code);
 $('.wrpPopOrdCtmView select[name="statusorderset"]').val(data.data.status);
 


$('.wrpPopOrdCtmView .orderdate').html(data.data.newdate);

var code='';
var code2='';
if(data.data.suborder.length)
{

$.each(data.data.suborder, function(key2, value2) {

if(value2.discount=='0.00')
{

code += '<div class="itmLstCart fs03 clearfix clBd2">\n';
code += '<div class="ct os1 clearfix">\n';
code += '<div class="pdImgCart">\n';
var imgpath=value2.simg;
code += '<img alt="img" src="'+imgpath.newpath+'">\n';
code += '</div>\n';
code += '<div class="pdNameCart">\n';
code += '<a class="boldGen" href="'+baseinfo+'/post/'+value2.productid+'">'+value2.title+'</a>\n';
code += '</div>\n';
code += '</div>\n';
code += '<div class="ct os2 clearfix"><span>'+value2.price+'</span></div>\n';
code += '<div class="ct os3 clearfix"><span>'+value2.count+'</span></div>\n';
code += '<div class="ct os4 clearfix"><span>'+value2.sum+'</span></div>\n';
code += '</div>';
}else
{

code2 += '<div class="itmLstCart fs03 clearfix clBd2">\n';
code2 += '<div class="ct os10 clearfix">\n';
code2 += '<span>'+value2.title+'</span>\n';
code2 += '</div>\n';
code2 += '<div class="ct os4 clearfix"><span>-'+value2.discount+'</span></div>\n';
code2 += '</div>';

}

});

}




$('.wrpPopOrdCtmView .cartitemwrp').html(code);
$('.wrpPopOrdCtmView .conponcart').html(code2);
var code3='';
if(data.data.transport.tspoid)
{
code3 += '<div class="ct os10">\n';
code3 += '<span>'+data.data.transport.tspname+'</span>\n';
code3 += '</div>\n';
code3 += '<div class="ct os5"><span>'+data.data.transport.tspcost+'</span></div>';
}

$('.wrpPopOrdCtmView .transportproduct').html(code3);

$('.wrpPopOrdCtmView .totalpricedata').html(data.data.sumall);

$('.wrpPopOrdCtmView .displaynameshow').html(data.data.customer.displayname);
$('.wrpPopOrdCtmView .emailshow').html(data.data.customer.emailcontact);
$('.wrpPopOrdCtmView .phoneshow').html(data.data.customer.phone);
$('.wrpPopOrdCtmView .addressshow').html(data.data.customer.shipaddressall);

$('.wrpPopOrdCtmView .noteshow').html(data.data.note);

$('.wrpPopOrdCtmView .btnAddTellPaid').attr('onclick','openpopuptranfer('+data.data.createby+','+data.data.orderid+')');
$('.wrpPopOrdCtmView .updatecartstatusbtn').attr('onclick','updatestatuscart('+data.data.orderid+')');
$('.wrpPopOrdCtmView .btnAddRef').attr('onclick','openpopupshipping('+data.data.orderid+')');


var code='';
if(data.data.userpay.length)
{

$.each(data.data.userpay, function(key, value) {

code += '<div class="bdShipInfo fs03">\n';
code += '<div class="showShipInfo clearfix">\n';
code += '<span class="si1 boldGen">Inform Date</span>\n';
code += '<span class="si2">'+value.newcreatedate+'</span>\n';
code += '</div>\n';
code += '<div class="showShipInfo clearfix">\n';
code += '<span class="si1 boldGen">Channel</span>\n';
code += '<span class="si2">Transfer : '+value.bankname+' '+value.branch+' '+value.accnumber+'</span>\n';
code += '</div>\n';
code += '<div class="showShipInfo clearfix">\n';
code += '<span class="si1 boldGen">Payment Date</span>\n';
code += '<span class="si2">'+value.newdatepay+'</span>\n';
code += '</div>\n';
code += '<div class="showShipInfo clearfix">\n';
code += '<span class="si1 boldGen">Payment Time</span>\n';
code += '<span class="si2">'+value.newtimedatepay+'</span>\n';
code += '</div>\n';
code += '<div class="showShipInfo clearfix">\n';
code += '<span class="si1 boldGen">Amount</span>\n';
code += '<span class="si2">'+value.amount+' Baht</span>\n';
code += '</div>\n';
code += '<div class="showShipInfo clearfix">\n';
code += '<span class="si1 boldGen">More Details</span>\n';
code += '<span class="si2">'+value.detail+'</span>\n';
code += '</div>\n';
code += '<div class="showShipInfo clearfix">\n';
code += '<span class="si1 boldGen">Attrach File</span>\n';
var imgpath=value.simg;
code += '<span class="si2"><img alt="" src="'+imgpath.newpath+'"></span>\n';
code += '</div>\n';
code += '</div>';

})
}

$('.wrpPopOrdCtmView .userpayshow').html(code);
$('.wrpPopOrdCtmView').fadeIn();






//$.each(data.data, function(key, value) {


//});


}



});

}
function updatestatuscart(orderid)
{
var arraydata={};
arraydata['orderid']=orderid;
arraydata['status']=$('select[name="statusorderset"]').val();
loaddata();
$.post(serviceinfo+'updatestatuscart',arraydata, function(data) {
   loadclosedata();   
    if(data.error.response)
    {
    alertbox(data.error.error);

    }else
    {
    boxmsgdata('Done');
    getorderlistbyorderid(orderid);
    }  
});

}
function getshopmyorderlist(pageorderlist,status)
{
var pageorderlistset=1;
var statusset=0;
if(pageorderlist)
{
pageorderlistset=pageorderlist;
}


if(status)
{
statusset=status;
}


$('.btntFiltOrdHtr').removeClass('btnFiltOrdHtrAct');
$('#shopidset-'+statusset).addClass('btnFiltOrdHtrAct');


loaddata();
$.get(serviceinfo+'getshopmyorderlist', {page:pageorderlistset,status:statusset}, function(data) {  
loadclosedata();

var code='';
var strtext='';
if(data.data.length)
{

$.each(data.data, function(key, value) {
code += '<div class="itmLstCart fs03 clBd2">\n';
code += '<div class="wrpInOrdHtr clearfix">\n';
code += '<div class="ct o1 clearfix">\n';
code += '<span>'+value['newdate']+'</span>\n';
code += '</div>\n';
code += '<div class="ct o2 boldGen clearfix">\n';
code += '<a href="'+baseinfo+'/'+value['username']+'">'+value['displayname']+'</a>\n';
code += '</div>\n';
code += '<div class="ct o3 boldGen clearfix">\n';
code += '<a href="javascript:void(0)" onclick="getorderlistbyorderid('+value['orderid']+')" class="btnOrdCtmView">'+value['orderprefix']+''+value['orderid']+'</a>\n';
code += '</div>\n';
code += '<div class="ct o4 clearfix">\n';
code += '<span>'+value['sumall']+'</span>\n';
code += '</div>\n';
code += '<div class="ct o5 boldGen clearfix">\n';
strtext='';
if(value['status']=='1')
{
strtext='<span onclick="openpopuptranfer('+value['createby']+','+value['orderid']+')">Reserve <em class="btnOrdHtrHtP">How to Pay</em></span>';

}else if(value['status']=='2')
{
strtext='<span>Paid </span>';

}
else if(value['status']=='3')
{
strtext='<span>Shipped <em class="btnOrdHtrRef" onclick="refnodata('+value['orderid']+')">Ref No.</em></span>';

}
else if(value['status']=='4')
{
strtext='<span>Canceled</span>';

}

code += '<span>'+strtext+'</span>\n';
code += '</div>\n';
code += '</div>\n';
code += '</div>';

});


}
$('.carttab .wrpItmLstCart').html(code);
if(pageorderlistset==1)
{
var param2,param3;
setpaginationnoreverse('.pageat2cart',data.count,5,'getshopmyorderlist',statusset,param2,param3);

}

});

}
function refnodata(orderid)
{
$.get(serviceinfo+'getrefnodata',{orderid:orderid}, function(data) {

$('.wrpPopShowRefNo .coderefno').html('');
$('.wrpPopShowRefNo .noterefno').html('');
if(data.data.code)
{
$('.wrpPopShowRefNo .coderefno').html(data.data.code);
$('.wrpPopShowRefNo .noterefno').html(data.data.note);
}

$('.wrpPopShowRefNo').fadeIn();

});

}
function loadcartmanage()
{
$.get(serviceinfo+'getcartmanage', function(data) {

var datarow=data.data;
if(datarow.shopname)
{
$('input[name="shopname"]').val(datarow.shopname);

}

if(datarow.orderprefix)
{
$('input[name="orderprefix"]').val(datarow.orderprefix);

}

if(datarow.curid)
{
$('select[name="curid"]').val(datarow.curid);

}

if(datarow.invent)
{
$('input[name="invent"]').filter('[value='+datarow.invent+']').prop('checked', true);

}

if(datarow.transportrow.length)
{

$.each(datarow.transportrow, function(key, value) {

addtransport(value.tspname,value.tspcost);

});

}else
{
addtransport();

}


if(datarow.transferrow.length)
{

$.each(datarow.transferrow, function(key, value) {

addpaymentsetting(value.bankid,value.accnumber,value.accname,value.branch,value.actypeid);

});

}else
{
addpaymentsetting();

}



if(datarow.paymentrow.length)
{

$.each(datarow.paymentrow, function(key, value) {

addpaymentetc(value.payname,value.paydescription);

});

}else
{
addpaymentetc();

}

if(datarow.transfer)
{
$('input[name="transfer"]').filter('[value='+datarow.transfer+']').prop('checked', true);

}

if(datarow.paypal)
{
$('input[name="paypal[]"]').filter('[value='+datarow.paypal+']').prop('checked', true);

}

if(datarow.paypalemail)
{
$('input[name="paypalemail[]"]').val(datarow.paypalemail);

}


if(datarow.paypoint)
{
$('input[name="paypoint[]"]').filter('[value='+datarow.paypoint+']').prop('checked', true);


}


if(datarow.point)
{
$('input[name="point"]').val(datarow.point);


}


if(datarow.paycredit)
{
$('input[name="paycredit"]').filter('[value='+datarow.paycredit+']').prop('checked', true);


}


if(datarow.etc)
{

$('input[name="etc"]').filter('[value='+datarow.etc+']').prop('checked', true);


}



});


}
function savecartmanage()
{
var arraydata={};
arraydata['shopname']=$('input[name="shopname"]').val();
arraydata['orderprefix']=$('input[name="orderprefix"]').val();
arraydata['curid']=$('select[name="curid"]').val();
arraydata['invent']=$('input[name="invent"]:checked').val();
arraydata['transportdata']=new Array();
var rownumber=0;
if($('.rowtransport').length)
{
$('.rowtransport').each(function( index ) {
if($(this).find('input[name="tspname[]"]').val()!=''&&$(this).find('input[name="tspcost[]"]').val()!='')
{
arraydata['transportdata'][rownumber]={};
arraydata['transportdata'][rownumber]['tspname']=$(this).find('input[name="tspname[]"]').val();
arraydata['transportdata'][rownumber]['tspcost']=$(this).find('input[name="tspcost[]"]').val();
rownumber++;

}


});
}

arraydata['invent']=$('input[name="invent"]:checked').val();

if($('input[name="transfer"]').is(':checked'))
{
arraydata['transfer']=1;
}else
{
arraydata['transfer']=0;

}



arraydata['transferdata']=new Array();
rownumber=0;
if($('.rowpayment').length)
{
$('.rowpayment').each(function( index ) {
if($(this).find('select[name="bankid[]"]').val()!=''&&$(this).find('input[name="accnumber[]"]').val()!=''&&$(this).find('input[name="accname[]"]').val()!=''&&$(this).find('input[name="branch[]"]').val()!=''&&$(this).find('select[name="actypeid[]"]').val()!='')
{
arraydata['transferdata'][rownumber]={};
arraydata['transferdata'][rownumber]['bankid']=$(this).find('select[name="bankid[]"]').val();
arraydata['transferdata'][rownumber]['accnumber']=$(this).find('input[name="accnumber[]"]').val();
arraydata['transferdata'][rownumber]['accname']=$(this).find('input[name="accname[]"]').val();
arraydata['transferdata'][rownumber]['branch']=$(this).find('input[name="branch[]"]').val();
arraydata['transferdata'][rownumber]['actypeid']=$(this).find('select[name="actypeid[]"]').val();
rownumber++;

}


});
}


if($('input[name="paypal[]"]').is(':checked'))
{
arraydata['paypal']=1;
}else
{
arraydata['paypal']=0;

}

arraydata['paypalemail']=$('input[name="paypalemail[]"]').val();


if($('input[name="paypoint[]"]').is(':checked'))
{
arraydata['paypoint']=1;
}else
{
arraydata['paypoint']=0;

}

arraydata['point']=$('input[name="point"]').val();


if($('input[name="paycredit"]').is(':checked'))
{
arraydata['paycredit']=1;
}else
{
arraydata['paycredit']=0;

}



if($('input[name="etc"]').is(':checked'))
{
arraydata['etc']=1;
}else
{
arraydata['etc']=0;

}

arraydata['paymentdata']=new Array();
rownumber=0;
if($('.rowpaymentetc').length)
{
$('.rowpaymentetc').each(function( index ) {
if($(this).find('input[name="payname[]"]').val()!=''&&$(this).find('textarea[name="paydescription[]"]').val()!='')
{
arraydata['paymentdata'][rownumber]={};
arraydata['paymentdata'][rownumber]['payname']=$(this).find('input[name="payname[]"]').val();
arraydata['paymentdata'][rownumber]['paydescription']=$(this).find('textarea[name="paydescription[]"]').val();
rownumber++;

}


});
}

loaddata();
$.post(serviceinfo+'savecartmanage',arraydata, function(data) {
   loadclosedata();   
    if(data.error.response)
    {
    alertbox(data.error.error);

    }else
    {
    boxmsgdata('Done');
    }  
});



}


$( document ).ready(function() {

loadcartmanage();
getshopmyorderlist();

imageset(1,350,350,150,150);
$( '.wrpPopTellPaid input[name="datepay"]' ).datepicker({dateFormat:'dd/mm/yy'});

<?if($_GET['orderid']){?>
getorderlistbyorderid(<?=$_GET['orderid']?>);
<?}?>

// Handler for .ready() called.
});
</script>


